package com.yinp.proapp.module.wanandroid.web.retrofit;

import com.yinp.proapp.module.wanandroid.bean.CollectionListBean;
import com.yinp.proapp.module.wanandroid.bean.NavigationListBean;
import com.yinp.proapp.module.wanandroid.bean.RankListBean;
import com.yinp.proapp.module.wanandroid.bean.WanOfficialAccountBean;
import com.yinp.proapp.module.wanandroid.bean.WanOfficialAccountListBean;
import com.yinp.proapp.module.wanandroid.bean.WanProjectListBean;
import com.yinp.proapp.module.wanandroid.bean.WanQuestionAnswerBean;
import com.yinp.proapp.module.wanandroid.bean.WanSquareListBean;
import com.yinp.proapp.module.wanandroid.bean.WanSysListBean;

import java.util.List;

import io.reactivex.Observable;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;

public interface WanApi {
    /**
     * 获取顶部banner
     *
     * @return
     */
    @GET("banner/json")
    Observable<WanData> getBannerList();

    /**
     * https://www.wanandroid.com/article/list/0/json
     *
     * @param size
     * @return
     */
    @GET("article/list/{size}/json")
    Observable<WanData> getHomArticleList(@Path("size") int size);

    /**
     * 获取置顶文章
     *
     * @return
     */
    @GET("article/top/json")
    Observable<WanData> getStickList();

    /**
     * 登录接口
     *
     * @param username
     * @param password
     * @return
     */
    @POST("user/login")
    Observable<WanData> login(@Query("username") String username, @Query("password") String password);

    /**
     * 获取自己得积分
     *
     * @return
     */
    @GET("lg/coin/userinfo/json")
    Observable<WanData> getIntegral();

    /**
     * 获取积分排行榜
     *
     * @return
     */
    @GET("coin/rank/{page}/json")
    Observable<WanData2<RankListBean>> getRankList(@Path("page") int page);

    /**
     * 获取体系列表
     *
     * @return
     */
    @GET("tree/json")
    Observable<WanData2<List<WanSysListBean>>> getSystemList();

    /**
     * 获取收藏列表
     * https://www.wanandroid.com/lg/collect/list/0/json
     *
     * @return
     */
    @GET("lg/collect/list/{page}/json")
    Observable<WanData2<CollectionListBean>> getCollectList(@Path("page") int page);

    /**
     * 获取导航数据
     * https://www.wanandroid.com/navi/json
     *
     * @return
     */
    @GET("navi/json")
    Observable<WanData2<List<NavigationListBean>>> getNavigationList();


    /**
     * 获取广场列表数据
     * https://wanandroid.com/user_article/list/页码/json
     *
     * @return
     */
    @GET("user_article/list/{page}/json")
    Observable<WanData2<WanSquareListBean>> getSquareList(@Path("page") int page);

    /**
     * 退出登录
     * https://www.wanandroid.com/user/logout/json
     *
     * @return
     */
    @GET("user/logout/json")
    Observable<WanData2<String>> loginOut();

    /**
     * 获取项目列表数据
     * https://wanandroid.com/article/listproject/0/json
     *
     * @return
     */
    @GET("article/listproject/{page}/json")
    Observable<WanData2<WanProjectListBean>> getProjectList(@Path("page") int page);


    /**
     * 获取项目列表数据
     * https://www.wanandroid.com/lg/collect/1165/json
     *
     * @return
     */
    @POST("lg/collect/{id}/json")
    Observable<WanData2> addCollect(@Path("id") int id);

    /**
     * 获取项目列表数据
     * https://www.wanandroid.com/lg/uncollect_originId/2333/json
     *
     * @return
     */
    @POST("lg/uncollect_originId/{id}/json")
    Observable<WanData2> cancelCollect(@Path("id") int id);

    /**
     * 获取项目列表数据
     * https://wanandroid.com/wenda/list/1/json
     *
     * @return
     */
    @GET("wenda/list/{page}/json")
    Observable<WanData2<WanQuestionAnswerBean>> getQuestionAnswerList(@Path("page") int page);


    /**
     * 获取公众号数据
     * https://wanandroid.com/wxarticle/chapters/json
     *
     * @return
     */
    @GET("wxarticle/chapters/json")
    Observable<WanData2<List<WanOfficialAccountBean>>> getOfficialAccount();

    /**
     * 获取公众号数据
     * https://wanandroid.com/wxarticle/list/408/1/json
     *
     * @return
     */
    @GET("wxarticle/list/{id}/{page}/json")
    Observable<WanData2<WanOfficialAccountListBean>> getOfficialAccountList(@Path("id") int id,@Path("page") int page);
}
